import { ReactNode } from 'react'
import { Redirect } from 'umi'

interface Iprops {
  children?: ReactNode
}

export default function Auth(props: Iprops) {
  const Authorization = localStorage.token
  if (!Authorization) {
    // 没有token就重定向
    return <Redirect to="/user/login" />
  } else {
    return <div>{props?.children}</div>
  }
}
